<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const name='张三';
        const age=18;
        const user={
            name:name,
            age:age,
            run:function(){

            }
        }

        //前提：键值命名一致
        const user1={
            name,
            age,
            run(){
                console.log('run')
            }
        }
        console.log(user)
        console.log(user1)
        user1.run()
    </script>
</body>
</html>